namespace nDeveloper.VSS.DifferenceEngine
{
    using System;
    using System.Collections;
    using System.IO;

    public class DiffList_TextFile : IDiffList
    {
        private ArrayList _lines = new ArrayList();
        private const int MaxLineLength = 0x400;

        public DiffList_TextFile(string fileName)
        {
            using (StreamReader reader = new StreamReader(fileName))
            {
                string str;
                while ((str = reader.ReadLine()) != null)
                {
                    if (str.Length > 0x400)
                    {
                        int num = 0x400;
                        throw new InvalidOperationException(string.Format("File contains a line greater than {0} characters.", num.ToString()));
                    }
                    this._lines.Add(new TextLine(str));
                }
            }
        }

        public int Count()
        {
            return this._lines.Count;
        }

        public IComparable GetByIndex(int index)
        {
            return (TextLine) this._lines[index];
        }
    }
}

